//
//  DoctorAppleTableViewCell.m
//  QuickCure
//
//  Created by huodian on 16/9/12.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "DoctorAppleTableViewCell.h"

#import "DoctorApplyModel.h"


@interface DoctorAppleTableViewCell()


@property(nonatomic,weak)UILabel* lable1;


@property(nonatomic,weak)UILabel* lable2;

@property(nonatomic,weak)UILabel* lable3;

@property(nonatomic,weak)UILabel* lable4;

@property(nonatomic,copy)NSString* string;



@property(nonatomic,strong)UIButton* btn;
@end


@implementation DoctorAppleTableViewCell

-(void)setString:(NSString *)string
{
    
    _string = string;
    
    
}

-(void)setModel:(DoctorApplyModel *)model
{
    _model = model;
    
    self.lable1.text = model.item1;
    
     self.lable2.text = model.item2;
    
     self.lable3.text = model.item3;
    
    self.lable4.text = model.item4;
    
    self.string = model.item5;
    
    [self.btn setTitle:self.string forState:UIControlStateNormal];
    
 
    
    

    
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
       [self setMyUIcell];
        
    }
    return self;
    
    
}

-(void)setMyUIcell
{
    //右边图标
    UIImage* image = [UIImage imageNamed:@"jt"];
    
    UIImageView* imageView = [[UIImageView alloc]initWithImage:image];
    

    
    [self.contentView addSubview:imageView];
    
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.trailing.equalTo(self.contentView).offset(-10);
        
        make.top.equalTo(self.contentView).offset(40);
        
        make.bottom.equalTo(self.contentView).offset(-40);
        
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.05);
        
    }];
    

    
    //圆
    UIButton* btn = [[UIButton alloc]init];
    
    self.btn = btn;
    
    [self.contentView addSubview:btn];
    
    [btn setBackgroundColor:[UIColor colorWithRed:18 /255.0 green:176/255.0 blue:174/255.0 alpha:1]];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(10);
        
        make.bottom.equalTo(self.contentView).offset(-10);
        
        make.width.equalTo(btn.mas_height);
        
        make.centerX.equalTo(imageView.mas_leading).offset(-40);
        
        make.centerY.equalTo(self.contentView);
    }];
    
   
    btn.layer.cornerRadius = 40;
    
    btn.clipsToBounds = YES;

    
    
   
    
    //中间线
    UIView* minView = [[UIView alloc]init];
    
    minView.backgroundColor  = [UIColor blackColor];
    
    [self.contentView addSubview:minView];
    
    
    [minView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.leading.equalTo(self.contentView.mas_leading).offset(10);
        
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0).offset(1);
        
        make.centerY.equalTo(self.contentView.mas_centerY);
        
        make.trailing.equalTo(btn.mas_leading).offset(0);
        
        
        
    }];
    
    
    //左上
    UILabel *lable1 = [[UILabel alloc]init];
    
    self.lable1 = lable1;
    
    lable1.font = [UIFont systemFontOfSize:16];
    
    [self.contentView addSubview:lable1];
    
    [lable1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(20);
        
        make.leading.equalTo(self.contentView).offset(20);
        
        make.bottom.equalTo(minView.mas_top).offset(-10);
     
    }];
    
    
    //左下
    UILabel *lable2 = [[UILabel alloc]init];
    
    
    
    lable2.font = [UIFont systemFontOfSize:16];
    self.lable3 = lable2;
    
    [self.contentView addSubview:lable2];
    
    [lable2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(minView.mas_top).offset(10);
        
        make.leading.equalTo(self.contentView).offset(20);
        
        make.bottom.equalTo(self.contentView).offset(-20);
        
    }];
    
    //右上
    UILabel *lable3 = [[UILabel alloc]init];
   
    lable3.font = [UIFont systemFontOfSize:16];
    
     self.lable2 = lable3;
    
    [self.contentView addSubview:lable3];
    
    [lable3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView).offset(20);
        
        make.leading.equalTo(lable1.mas_trailing).offset(20);
        
        make.bottom.equalTo(minView.mas_top).offset(-10);
        
    }];
    
    //右下
    UILabel *lable4 = [[UILabel alloc]init];
    
    lable4.font = [UIFont systemFontOfSize:16];
    
     self.lable4 = lable4;
    
    [self.contentView addSubview:lable4];
    
    [lable4 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(minView.mas_bottom).offset(10);
        
        make.leading.equalTo(lable2.mas_trailing).offset(20);
        
        make.bottom.equalTo(self.contentView).offset(-20);
        
    }];
    
}



@end
